import React, { useCallback, useEffect, useState } from 'react'
import $axios from '@/plugins/request'
import {
  message,
  Form,
  Input,
  Button,
  Radio,
  Select,
  Cascader,
  DatePicker,
  InputNumber,
  TreeSelect,
  Switch,
  Rate,
} from 'antd';
import AUForm from './AUForm'


class Edit extends React.Component {
  state = {
    data: {}
  }

  getData = async () => {
    const { id } = this.props.match.params;
    const { data: res } = await $axios.get(`/api/branch/${id}`)
    this.setState({ data: res.data })
  }

  componentDidMount() {
    this.getData();
  }

  render() {
    return <AUForm data={this.state.data} />
  }
}
export default Edit;

// function Edit(props) {

//   let [data, setData] = useState({})

//   const getData = useCallback(async () => {
//     const { id } = props.match.params;
//     const { data: res } = await $axios.get(`/api/party/${id}`)
//    setData({ data: res.data })
//   },[])

//   useEffect(()=>{
//     getData();
//   },[getData])

//   return <AUForm data={data} />
// }
// export default Edit;